package com.example;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;


public class DateTest {
    public static void main(String[] args) {
//        String input = "20220101";
//        int incrementBy = 1;
//        String output = incrementStringDate(input, incrementBy);
//        System.out.println("Output: " + output);
//        String string="{\n" +
//                "\t\"code\":0,\n" +
//                "\t\"data\":{\n" +
//                "\t\t\"end_time\":1691465100000,\n" +
//                "\t\t\"start_time\":1691285100000\n" +
//                "\t},\n" +
//                "\t\"msg\":\"操作成功！\",\n" +
//                "\t\"success\":true\n" +
//                "}";
//
//        String newString="{\n" +
//                "\t\"code\":0,\n" +
//                "\t\"data\":[\n" +
//                "\t\t{\n" +
//                "\t\t\t\"complete\":0,\n" +
//                "\t\t\t\"current\":0,\n" +
//                "\t\t\t\"order\":1,\n" +
//                "\t\t\t\"ptime\":\"2988\",\n" +
//                "\t\t\t\"startTime\":\"2023-08-07 08:29:21\",\n" +
//                "\t\t\t\"time\":\"49:48:00\",\n" +
//                "\t\t\t\"timestamp\":4002437,\n" +
//                "\t\t\t\"total\":0,\n" +
//                "\t\t\t\"userTime\":2988,\n" +
//                "\t\t\t\"username\":\"超管\"\n" +
//                "\t\t},\n" +
//                "\t\t{\n" +
//                "\t\t\t\"complete\":0,\n" +
//                "\t\t\t\"current\":0,\n" +
//                "\t\t\t\"order\":2,\n" +
//                "\t\t\t\"ptime\":\"66\",\n" +
//                "\t\t\t\"startTime\":\"2023-08-03 09:25:55\",\n" +
//                "\t\t\t\"time\":\"1:6:00\",\n" +
//                "\t\t\t\"timestamp\":7992803,\n" +
//                "\t\t\t\"total\":0,\n" +
//                "\t\t\t\"unit\":\"城区分局\",\n" +
//                "\t\t\t\"userTime\":66,\n" +
//                "\t\t\t\"username\":\"庞亚伦\"\n" +
//                "\t\t},\n" +
//                "\t\t{\n" +
//                "\t\t\t\"complete\":0,\n" +
//                "\t\t\t\"current\":0,\n" +
//                "\t\t\t\"order\":3,\n" +
//                "\t\t\t\"ptime\":\"89\",\n" +
//                "\t\t\t\"startTime\":\"2023-08-03 09:25:47\",\n" +
//                "\t\t\t\"time\":\"1:29:00\",\n" +
//                "\t\t\t\"timestamp\":7992811,\n" +
//                "\t\t\t\"total\":0,\n" +
//                "\t\t\t\"unit\":\"郊区分局\",\n" +
//                "\t\t\t\"userTime\":89,\n" +
//                "\t\t\t\"username\":\"王宾\"\n" +
//                "\t\t},\n" +
//                "\t\t{\n" +
//                "\t\t\t\"complete\":0,\n" +
//                "\t\t\t\"current\":0,\n" +
//                "\t\t\t\"order\":4,\n" +
//                "\t\t\t\"ptime\":\"81\",\n" +
//                "\t\t\t\"startTime\":\"2023-08-03 09:25:37\",\n" +
//                "\t\t\t\"time\":\"1:21:00\",\n" +
//                "\t\t\t\"timestamp\":7992821,\n" +
//                "\t\t\t\"total\":0,\n" +
//                "\t\t\t\"unit\":\"西城分局\",\n" +
//                "\t\t\t\"userTime\":81,\n" +
//                "\t\t\t\"username\":\"王凯\"\n" +
//                "\t\t},\n" +
//                "\t\t{\n" +
//                "\t\t\t\"complete\":0,\n" +
//                "\t\t\t\"current\":0,\n" +
//                "\t\t\t\"order\":5,\n" +
//                "\t\t\t\"ptime\":\"73\",\n" +
//                "\t\t\t\"startTime\":\"2023-08-03 09:25:33\",\n" +
//                "\t\t\t\"time\":\"1:13:00\",\n" +
//                "\t\t\t\"timestamp\":7992825,\n" +
//                "\t\t\t\"total\":0,\n" +
//                "\t\t\t\"unit\":\"平定县公安局\",\n" +
//                "\t\t\t\"userTime\":73,\n" +
//                "\t\t\t\"username\":\"阎邵杰\"\n" +
//                "\t\t},\n" +
//                "\t\t{\n" +
//                "\t\t\t\"complete\":0,\n" +
//                "\t\t\t\"current\":0,\n" +
//                "\t\t\t\"order\":6,\n" +
//                "\t\t\t\"ptime\":\"69\",\n" +
//                "\t\t\t\"startTime\":\"2023-08-03 09:25:32\",\n" +
//                "\t\t\t\"time\":\"1:9:00\",\n" +
//                "\t\t\t\"timestamp\":7992826,\n" +
//                "\t\t\t\"total\":0,\n" +
//                "\t\t\t\"unit\":\"矿区分局\",\n" +
//                "\t\t\t\"userTime\":69,\n" +
//                "\t\t\t\"username\":\"王常\"\n" +
//                "\t\t},\n" +
//                "\t\t{\n" +
//                "\t\t\t\"complete\":0,\n" +
//                "\t\t\t\"current\":0,\n" +
//                "\t\t\t\"order\":7,\n" +
//                "\t\t\t\"ptime\":\"71\",\n" +
//                "\t\t\t\"startTime\":\"2023-08-03 09:25:25\",\n" +
//                "\t\t\t\"time\":\"1:11:00\",\n" +
//                "\t\t\t\"timestamp\":7992833,\n" +
//                "\t\t\t\"total\":0,\n" +
//                "\t\t\t\"unit\":\"开发分局\",\n" +
//                "\t\t\t\"userTime\":71,\n" +
//                "\t\t\t\"username\":\"史恒飞\"\n" +
//                "\t\t},\n" +
//                "\t\t{\n" +
//                "\t\t\t\"complete\":0,\n" +
//                "\t\t\t\"current\":0,\n" +
//                "\t\t\t\"order\":8,\n" +
//                "\t\t\t\"ptime\":\"35\",\n" +
//                "\t\t\t\"startTime\":\"2023-08-03 09:25:24\",\n" +
//                "\t\t\t\"time\":\"0:35:00\",\n" +
//                "\t\t\t\"timestamp\":7992834,\n" +
//                "\t\t\t\"total\":0,\n" +
//                "\t\t\t\"unit\":\"阳泉市公安局\",\n" +
//                "\t\t\t\"userTime\":35,\n" +
//                "\t\t\t\"username\":\"吕睿麒\"\n" +
//                "\t\t},\n" +
//                "\t\t{\n" +
//                "\t\t\t\"complete\":0,\n" +
//                "\t\t\t\"current\":0,\n" +
//                "\t\t\t\"order\":9,\n" +
//                "\t\t\t\"ptime\":\"65\",\n" +
//                "\t\t\t\"startTime\":\"2023-08-03 09:25:09\",\n" +
//                "\t\t\t\"time\":\"1:5:00\",\n" +
//                "\t\t\t\"timestamp\":7992849,\n" +
//                "\t\t\t\"total\":0,\n" +
//                "\t\t\t\"unit\":\"盂县公安局\",\n" +
//                "\t\t\t\"userTime\":65,\n" +
//                "\t\t\t\"username\":\"李子龙\"\n" +
//                "\t\t}\n" +
//                "\t],\n" +
//                "\t\"msg\":\"操作成功！\",\n" +
//                "\t\"success\":true\n" +
//                "}";
//
//        JSONObject jsonObject=JSONObject.parseObject(string);
//        JSONObject object=JSONObject.parseObject(newString);
//        Object data=object.get("data");
//        String newJson=JSON.toJSON(data).toString();
//
//
//
//
//// 数组
//        List<Map> inventoryDTOs = JSON.parseArray(newJson, Map.class);
//// 对象
//
//        System.err.println(data);
//        String jsonString=jsonObject.getString("data");
//
//        Object o=jsonObject.get("data");
//        Map<String,Object> map = JSONObject.parseObject(JSON.toJSONString(o));
        Integer divisor=5;Integer dividend=7;
        BigDecimal bigDecimalDivisor=new BigDecimal(divisor);
        BigDecimal bigDecimalDividend=new BigDecimal(dividend);
        BigDecimal bigDecimal=bigDecimalDivisor.divide(bigDecimalDividend,2+2, RoundingMode.HALF_UP);


        double res=bigDecimal.doubleValue();
        System.err.println(res);
    }

    public static String incrementStringDate(String inputDate, int incrementBy) {

        // 定义日期格式
        DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
        Date date = new Date(System.currentTimeMillis());
        // 将输入的字符串转为日期类型
        System.out.println(formatter.format(date));

        // 使用 Calendar 类进行日期操作
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        // 增加指定的天数
        calendar.add(Calendar.DATE, 0);

        // 将结果日期转回字符串类型
        String outputDate = dateFormat.format(calendar.getTime());
        // 在日期字符串的末尾添加"0001"
        outputDate += "0001";

        return outputDate;

    }

    public static String percent(Integer divisor,Integer dividend,Integer digit){
        BigDecimal bigDecimalDivisor=new BigDecimal(divisor);
        BigDecimal bigDecimalDividend=new BigDecimal(dividend);
        BigDecimal bigDecimal=bigDecimalDivisor.divide(bigDecimalDividend);
        System.err.println(bigDecimal);
        return null;
    }

}